package cn.cs.service;

import cn.cs.mapper.AgentOrderMapper;
import cn.cs.mapper.AgentTypeMapper;
import cn.cs.pojo.AgentOrder;
import cn.cs.pojo.AgentType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class AgetnTypeService {

    @Resource
    private AgentTypeMapper agentTypeMapper;

    @RequestMapping(value = "/getAgentTypeById", method = RequestMethod.POST)
    public AgentType getAgentTypeById(@RequestParam("id") String id) throws Exception{
        return agentTypeMapper.getAgentTypeById(id);
    }

    @RequestMapping(value = "/getAgentTypeListByMap", method = RequestMethod.POST)
    public List<AgentType> getAgentTypeListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return agentTypeMapper.getAgentTypeListByMap(param);
    }

    @RequestMapping(value = "/getAgentTypeCountByMap", method = RequestMethod.POST)
    public Integer getAgentTypeCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return agentTypeMapper.getAgentTypeCountByMap(param);
    }

    @RequestMapping(value = "/addAgentType", method = RequestMethod.POST)
    public Integer addAgentType(@RequestBody AgentType agentType) throws Exception{
        return agentTypeMapper.insertAgentType(agentType);
    }

    @RequestMapping(value = "/modifyAgentType", method = RequestMethod.POST)
    public Integer modifyAgentType(@RequestBody AgentType agentType) throws Exception{
        return agentTypeMapper.updateAgentType(agentType);
    }

    @RequestMapping(value = "/deleteAgentTypeById", method = RequestMethod.POST)
    public Integer deleteAgentTypeById(@RequestParam("id") String id) throws Exception{
        return agentTypeMapper.deleteAgentTypeById(id);
    }

}
